//
//  YDMinePositionBottomView.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2017/11/13.
//  Copyright © 2017年 LK-IOS. All rights reserved.
//

#import "YDMinePositionBottomView.h"
#import "YDHoldPositionModel.h"

@interface YDMinePositionBottomView()
//分割线
@property (nonatomic , weak) UIView *Hline1;
@property (nonatomic , weak) UIView *Hline2;
@property (nonatomic , weak) UIView *Vline1;
@property (nonatomic , weak) UIView *Vline2;
//标题label
@property (nonatomic , weak) UILabel *label1;//总点买
@property (nonatomic , weak) UILabel *label2;//今日买入
@property (nonatomic , weak) UILabel *label3;//履约保证金
@property (nonatomic , weak) UILabel *label4;//持仓保证金

//金额数值
@property (nonatomic , weak) UILabel *labelN1;//总点买
@property (nonatomic , weak) UILabel *labelN2;//今日买入
@property (nonatomic , weak) UILabel *labelN3;//履约保证金
@property (nonatomic , weak) UILabel *labelN4;//持仓保证金

@end

@implementation YDMinePositionBottomView

-(void)setModel:(YDHoldPositionModel *)model
{
    _model = model;
    
    self.labelN1.text = model.pzTotalApplyAmount;
    self.labelN2.text = model.pzTodayApplyAmount;
    self.labelN3.text = model.pzFrozenAmount;
    self.labelN4.text = model.pzDeferredAmount;
    
}
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
        [self Hline1];
        [self Hline2];
        [self Vline1];
        [self Vline2];
        
        [self label1];
        [self label2];
        [self label3];
        [self label4];
        
        [self labelN1];
        [self labelN2];
        [self labelN3];
        [self labelN4];
        
    }
    return self;
}

+(instancetype)minePositionBottomViewWithModel:(YDHoldPositionModel *)model
{
    YDMinePositionBottomView *bottomView = [[self alloc] init];
    bottomView.model = model;
    return bottomView;
    
}

-(UIView *)Hline1
{
    if (_Hline1 == nil) {
        UIView *Hline1 = [[UIView alloc] init];
        [self addSubview:Hline1];
        Hline1.backgroundColor = NumberColor(247, 247, 247);
        [Hline1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(self);
            make.left.right.equalTo(self);
            make.height.equalTo(@1);
        }];
        
        _Hline1 = Hline1;
    }
    return _Hline1;
}
-(UIView *)Hline2
{
    if (_Hline2 == nil) {
        UIView *Hline2 = [[UIView alloc] init];
        [self addSubview:Hline2];
        Hline2.backgroundColor = NumberColor(247, 247, 247);
        [Hline2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self);
            make.left.right.equalTo(self);
            make.height.equalTo(@1);
        }];
        
        _Hline2 = Hline2;
    }
    return _Hline2;
}
-(UIView *)Vline1
{
    if (_Vline1 == nil) {
        UIView *Vline1 = [[UIView alloc] init];
        [self addSubview:Vline1];
        Vline1.backgroundColor = NumberColor(247, 247, 247);
        [Vline1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.width.equalTo(@1);
            if (isPhoneX) {
                make.height.equalTo(@(rateX812(30)));
                make.top.equalTo(self).offset(rateX812(19));
            }else{
                make.height.equalTo(@(rate750(30)));
                make.top.equalTo(self).offset(rate750(19));
            }
        }];
        
        _Vline1 = Vline1;
    }
    return _Vline1;
}
-(UIView *)Vline2
{
    if (_Vline2 == nil) {
        UIView *Vline2 = [[UIView alloc] init];
        [self addSubview:Vline2];
        Vline2.backgroundColor = NumberColor(247, 247, 247);
        [Vline2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.width.equalTo(@1);
            if (isPhoneX) {
                make.height.equalTo(@(rateX812(30)));
                make.bottom.equalTo(self).offset(-rateX812(19));
            }else{
                make.height.equalTo(@(rate750(30)));
                make.bottom.equalTo(self).offset(-rate750(19));
            }
        }];
        
        _Vline2 = Vline2;
    }
    return _Vline2;
}

-(UILabel *)label1
{
    if (_label1 == nil) {
        UILabel *label1 = [[UILabel alloc] init];
        [self addSubview:label1];// 173 179 193
        label1.textAlignment = NSTextAlignmentCenter;
        label1.font = [UIFont systemFontOfSize:font12ScreenWRate * LKScreenW];
        label1.textColor = NumberColor(173, 179, 193);
        label1.text = @"总点买（元）";
        [label1  mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_centerX).offset(-rate375(57));
            if (isPhoneX) {
                make.top.equalTo(self).offset(rateX812(12));
            }else{
                make.top.equalTo(self).offset(rate750(12));
            }
        }];
        
        _label1 = label1;
    }
    return _label1;
}
-(UILabel *)label2
{
    if (_label2 == nil) {
        UILabel *label2 = [[UILabel alloc] init];
        [self addSubview:label2];// 173 179 193
        label2.textAlignment = NSTextAlignmentCenter;
        label2.font = [UIFont systemFontOfSize:font12ScreenWRate * LKScreenW];
        label2.textColor = NumberColor(173, 179, 193);
        label2.text = @"今日买入（元）";
        [label2  mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_centerX).offset(rate375(57));
            if (isPhoneX) {
                make.top.equalTo(self).offset(rateX812(12));
            }else{
                make.top.equalTo(self).offset(rate750(12));
            }
        }];
        
        _label2 = label2;
    }
    return _label2;
}

-(UILabel *)label3
{
    if (_label3 == nil) {
        UILabel *label3 = [[UILabel alloc] init];
        [self addSubview:label3];// 173 179 193
        label3.textAlignment = NSTextAlignmentCenter;
        label3.font = [UIFont systemFontOfSize:font12ScreenWRate * LKScreenW];
        label3.textColor = NumberColor(173, 179, 193);
        label3.text = @"履约保证金（元）";
        [label3  mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.label1);
            if (isPhoneX) {
                make.top.equalTo(self.Hline1.mas_bottom).offset(rateX812(12));
            }else{
                make.top.equalTo(self.Hline1.mas_bottom).offset(rate750(12));
            }
        }];
        _label3 = label3;
    }
    return _label3;
}

-(UILabel *)label4
{
    if (_label4 == nil) {
        UILabel *label4 = [[UILabel alloc] init];
        [self addSubview:label4];// 173 179 193
        label4.textAlignment = NSTextAlignmentCenter;
        label4.font = [UIFont systemFontOfSize:font12ScreenWRate * LKScreenW];
        label4.textColor = NumberColor(173, 179, 193);
        label4.text = @"持仓递延费（元）";
        [label4  mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.label2);
            if (isPhoneX) {
                make.top.equalTo(self.Hline1.mas_bottom).offset(rateX812(12));
            }else{
                make.top.equalTo(self.Hline1.mas_bottom).offset(rate750(12));
            }
        }];
        
        _label4 = label4;
    }
    return _label4;
}

-(UILabel *)labelN1
{
    if (_labelN1 == nil) {
        UILabel *labelN1 = [[UILabel alloc] init];
        [self addSubview:labelN1];// 173 179 193
        labelN1.textAlignment = NSTextAlignmentCenter;
        labelN1.font = [UIFont systemFontOfSize:font16ScreenWRate * LKScreenW];
        labelN1.textColor = [UIColor colorWithHexString:dark];
        labelN1.text = @"";
        [labelN1  mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.label1);
            if (isPhoneX) {
                make.top.equalTo(self.label1.mas_bottom).offset(rateX812(5));
            }else{
                make.top.equalTo(self.label1.mas_bottom).offset(rate750(5));
            }
        }];
        
        _labelN1 = labelN1;
    }
    return _labelN1;
}
-(UILabel *)labelN2
{
    if (_labelN2 == nil) {
        UILabel *labelN2 = [[UILabel alloc] init];
        [self addSubview:labelN2];// 173 179 193
        labelN2.textAlignment = NSTextAlignmentCenter;
        labelN2.font = [UIFont systemFontOfSize:font16ScreenWRate * LKScreenW];
        labelN2.textColor = [UIColor colorWithHexString:dark];
        labelN2.text = @"";
        [labelN2  mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.label2);
            if (isPhoneX) {
                make.top.equalTo(self.label2.mas_bottom).offset(rateX812(5));
            }else{
                make.top.equalTo(self.label2.mas_bottom).offset(rate750(5));
            }
        }];
        
        _labelN2 = labelN2;
    }
    return _labelN2;
}
-(UILabel *)labelN3
{
    if (_labelN3 == nil) {
        UILabel *labelN3 = [[UILabel alloc] init];
        [self addSubview:labelN3];// 173 179 193
        labelN3.textAlignment = NSTextAlignmentCenter;
        labelN3.font = [UIFont systemFontOfSize:font16ScreenWRate * LKScreenW];
        labelN3.textColor = [UIColor colorWithHexString:dark];
        labelN3.text = @"";
        [labelN3  mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.label3);
            if (isPhoneX) {
                make.top.equalTo(self.label3.mas_bottom).offset(rateX812(5));
            }else{
                make.top.equalTo(self.label3.mas_bottom).offset(rate750(5));
            }
        }];
        
        _labelN3 = labelN3;
    }
    return _labelN3;
}
-(UILabel *)labelN4
{
    if (_labelN4 == nil) {
        UILabel *labelN4 = [[UILabel alloc] init];
        [self addSubview:labelN4];// 173 179 193
        labelN4.textAlignment = NSTextAlignmentCenter;
        labelN4.font = [UIFont systemFontOfSize:font16ScreenWRate * LKScreenW];
        labelN4.textColor = [UIColor colorWithHexString:dark];
        labelN4.text = @"";
        [labelN4  mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.label4);
            if (isPhoneX) {
                make.top.equalTo(self.label4.mas_bottom).offset(rateX812(5));
            }else{
                make.top.equalTo(self.label4.mas_bottom).offset(rate750(5));
            }
        }];
        _labelN4 = labelN4;
    }
    return _labelN4;
}


-(void)setFrame:(CGRect)frame
{
    [super setFrame:frame];
    
    
    
}

@end
